PowerTools CalendarGrid for Windows Forms 1.0J
キーワードによる書式設定

概要

CalendarGcTimeSpanCellType.Fields.AddRangeメソッドを使用すると、キーワードによる書式設定を利用できます。

CalendarGcTimeSpanCellTypeでは、キーワードによる書式設定が可能です。

入力書式を設定するには、Fieldsプロパティが参照するTimeSpanFieldCollectionクラスのAddRangeメソッドに、入力書式用のキーワードを使用した文字列を設定します。
表示書式を設定するには、DisplayFieldsプロパティが参照するTimeSpanDisplayFieldCollectionクラスのAddRangeメソッドに、表示書式用のキーワードを使用した文字列を設定します。

キーワードは文字列として次の順番で定義します。        

Pattern, Decimal Places, Decimal Point, Positive Prefix, Positive Suffix, Negative Prefix, Negative Suffix

Imports InputManCell = GrapeCity.Win.CalendarGrid.InputMan

Dim today As DateTime = DateTime.Today
Dim GcTimeSpanCellType As New InputManCell.CalendarGcTimeSpanCellType()

' フィールドをクリアします。
GcTimeSpanCellType.Fields.Clear()
GcTimeSpanCellType.DisplayFields.Clear()

' キーワードから書式を設定します。
GcTimeSpanCellType.Fields.AddRange("hh時間mm分ss秒,0,.,,,-,")
GcTimeSpanCellType.DisplayFields.AddRange("hh時間mm分ss秒,0,.,,,-,")

GcCalendarGrid1.Content(today).Rows(1).Cells(0).CellType = GcTimeSpanCellType
GcCalendarGrid1.ScrollIntoView(today)
using InputManCell = GrapeCity.Win.CalendarGrid.InputMan;

var today = DateTime.Today;
var gcTimeSpanCellType = new InputManCell.CalendarGcTimeSpanCellType();

// フィールドをクリアします。
gcTimeSpanCellType.Fields.Clear();
gcTimeSpanCellType.DisplayFields.Clear();

// キーワードから書式を設定します。
gcTimeSpanCellType.Fields.AddRange("hh時間mm分ss秒,0,.,,,-,");
gcTimeSpanCellType.DisplayFields.AddRange("hh時間mm分ss秒,0,.,,,-,");

gcCalendarGrid1.Content[today].Rows[1].Cells[0].CellType = gcTimeSpanCellType;
gcCalendarGrid1.ScrollIntoView(today);


入力書式のキーワード

入力書式として使用可能なキーワードは以下のとおりです。
キーワード 説明

dd

先頭に0を付けて日を入力

hh

先頭に0を付けて時を入力

mm

先頭に0を付けて分を入力

ss

先頭に0を付けて秒を入力


表示書式のキーワード

表示書式として使用可能なキーワードは以下のとおりです。
キーワード 説明

d

日を表示(先頭に0を付けない)

dd

日を2桁で表示(先頭に0を付ける)

h

時を表示(先頭に0を付けない)

hh

時を2桁で表示(先頭に0を付ける)

m

分を表示(先頭に0を付けない)

mm

分を2桁で表示(先頭に0を付ける)

s

秒を表示(先頭に0を付けない)

ss

行を2桁で表示(先頭に0を付ける)


参照

 

 


© 2014 GrapeCity inc. All rights reserved.